#!/bin/bash

# 该脚本的作用是初始化所有的业务数据，只需执行一次

MAXWELL_HOME=/opt/module/maxwell

import_data() {
    $MAXWELL_HOME/bin/maxwell-bootstrap --database edu --table $1 --config $MAXWELL_HOME/config.properties
}
case $1 in
#导入所有增量表
"all")
import_data "base_category_info"
import_data "base_province"
import_data "base_source"
import_data "base_subject_info"
import_data "cart_info"
import_data "chapter_info"
import_data "course_info"
import_data "knowledge_point"
import_data "test_paper"
import_data "test_paper_question"
import_data "test_point_question"
import_data "test_question_info"
import_data "test_question_option"
import_data "video_info"
;;
"base_category_info")
    import_data "base_category_info"
;;
"base_province")
    import_data "base_province"
;;
"base_source")
    import_data "base_source"
;;
"base_subject_info")
    import_data "base_subject_info"
;;
"cart_info")
    import_data "cart_info"
;;
"chapter_info")
    import_data "chapter_info"
;;
"course_info")
    import_data "course_info"
;;
"knowledge_point")
    import_data "knowledge_point"
;;
"test_paper")
    import_data "test_paper"
;;
"test_paper_question")
    import_data "test_paper_question"
;;
"test_point_question")
    import_data "test_point_question"
;;
"test_question_info")
    import_data "test_question_info"
;;
"test_question_option")
    import_data "test_question_option"
;;
"video_info")
    import_data "video_info"
;;
*)
    echo "表名输入错误..."
;;
esac
